<extend name="Base:base" />
<block name="title">{$title}</block>
<block name="content">
    <form action="" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">修改用户<span class="check-tips">（用于后台用户）</span></label>
            <div class="controls">
                <input type="text" name="username" value="{$user.name}">
                <input type="hidden" name="user_id" value="{$user.id}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">登陆密码<span class="check-tips">（用于后台用户登陆密码）</span></label>
            <div class="controls">
                <input type="text" name="password" placeholder="请更换密码">
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">所属角色<span class="check-tips">（用于后台用户所属角色）</span></label>
            <foreach name="user['user_roles']" item='user_role'>
                <div class="controls">
                    <select name="role_id[]">
                         <option value="">--选择角色（不设置）--</option>
                        <foreach name="roles" item="role">
                            <option value="{$role.id}" <if condition="$user_role['role_id'] eq $role['id']">selected</if>>{$role.name}({$role.remark})</option>
                        </foreach>
                    </select>
                </div>
            </foreach>
            <select name="role_id[]">
                <option value="">--选择角色（不设置）--</option>
                <foreach name="roles" item="role">
                    <option value="{$role.id}">{$role.name}({$role.remark})</option>
                </foreach>
            </select>
        </div>
        <div class="form-item">
            <input type="hidden" name="id" value="{$user.id}">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">保存修改</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);
                    return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('user')}');
    </script>
</block>
